home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Space & Astronomy
/
Space and Astronomy (October 1993).iso
/
mac
/
VIEWERS
/
OS2
/
VIEWGIF1.ZIP
/
VIEWGIF.DOC
next >
Wrap
Text File
|
1990-04-09
|
13KB
|
267 lines
VIEWGIF ver 1.60
----------------
This program allows viewing GIF files under OS/2 Presentation Manager.
It requires a VGA or super VGA card and works best with a 256 color
PM driver (now available for Video 7 VRAM VGA and NEC Graphics Engine).
I don't know how it works with the IBM 8514/A card, but I think the DAC
registers are also VGA compatible.
For loading a file you can select if you alter the palette registers directly
(VGA only) or let OS/2 do it for you (with dithered colors).
This is a true OS/2 PM program, so it does not run under DOS or the DOS
compatibility box. There are already enough ones for DOS (VPIC, etc.).
The program is public domain and you can spread and copy it as much you want.
The program can also read DeluxePaint LBM files, but not LBM files created by
DP II Enhanced. I don't know the unpacking algorithm on DP II Enhanced. It can
also handle ZSOft .PCX files until version 3.00.
The Grab menu creates also (unpacked) DeluxePaint II files, in the same way as
the CAMERA utility does under DOS.
The command line switch -c or /c enables direct palette manipulation as a
default. You can Associate in the File System VIEWGIF -C for all .PCX, .GIF and
.LBM files.
The command line switch -n or /n disables the confirmation on quitting the
program or loading another file when the current bitmap is modified and not
saved yet.
The command line switch -4 will load a 256 color picture in a dithered 16 color
image with the default PM palette.
Menu items:
Menu bar(F10 or doubleclick):
Toggles menubar/titlebar display.
File (F):
change directory and load picture file (Only .GIF, .PCX and .LBM
extensions are enabled). With marking the Direct Palette manipulation
check box, the program changes the VGA DAC registers directly so the
other programs in the PM session 'go technicolor'. In this case a task
switch with Ctrl-Esc or Alt-Esc or popping up the file menu will restore
the PM default palette and the GIF picture is in false color. This
works only with pictures with less or equal number of colors than the VGA
driver. When the checkbox is not marked (or the picture has too many
colors, e.g. a 256 color GIF on a standard VGA) the closest matching PM
colors will be used.
Scale (S):
Toggle scaled display within the window and part of picture in window.
The method of scaling is one of three bitmap compression methods provided
by PM (keys 1,2 or 3). The redrawing is somewhat slow, it takes a few
seconds to redraw a 640x480 picture on a 16 MHz AT. This is because of the
GpiBitBlt() function. The 'N' key turns scaling off anyway. Scrolling
through the picture can be done with the cursor keys (PgUp,PgDn, Home,
End, Arrows) when scaling is off and the picture does not fit in the
window. When Save is pressed, the picture will be saved in the scaled way
when Scale is on, so you can expand or shrink pictures and save them
again.
Palette (P):
Change colors (only enabled when the picture has not more colors than the
display device driver). When the Rewrite check box is enabled, the program
rewrites the color table to the GIF header (GIF files only).
The RGB slides can also be controlled by the enhanced keyboard
Red: Insert/Delete, Green: Home/End, Blue: PgUp/PgDn 'grey' keys. Arrow
up/down move to previous/next color.
Save Method (M):
Selects the .GIF, DeLuxePaint .LBM or ZSoft .PCX format as save option.
Update (U):
Reads the contents of the main window of VIEWGIF and writes it to a
DeluxePaint .LBM or a ZSoft .PCX file, depending on the Save Method menu.
A Z pressed in the main window forces PCX format and sets the save format
to it, and a D forces DeluxePaint format, a G forces GIF format.
When SCALE is enabled, the picture will be saved with the same picture
size as the window, so you can save scaled pictures.
Saving will be done in four bits (16 colors) or eight bits (256 colors)
dependant on the current PM driver. When the picture has one color bit
(B/W pictures) the file will be saved in one bit when GIF or PCX is
selected.
Update Window(W):
Reads a part of the main window of VIEWGIF. Can be selected by the mouse.
The initial size of the mouse window is 320x200.
Capture(C):
Captures the entire PM session screen in a file in .GIF, .PCX or .LBM
format, dependant on the save mode. You can also select a particular area
of the screen. Initial size = 320x200, but can be expanded.
Icons:
When Icon is selected in the Grab menu (64x64 is best , because it is
device independent) you can create icons. After selecting Icon, VIEWGIF
asks you for the size. Minimum is 32x32, maximum is 320x256.The Icon
Editor is a somewhat cumbersome tool, because you can just draw dots and
little squares and that is all. No circles, nonharizontal and nonvertical
lines. With Viewgif a GIF or PCX or LBM picture can be shrinked to a
bitmap of the specified size which can be transferred to the system
clipboard and then be pasted (paste option) by the Icon Editor provided
with the OS/2 Programmer's Toolkit. Unfortunately, the colors of IconEdit
cannot be changed by the bitmap which comes from the clipboard, so the
colors do not match, because the default colormap of Iconedit does not
match the system colormap. Therefore I provide a custom icon called
CUSTOM.ICO with the default color map for 16 colors. You can use any
paint program for creating icons for PM (I use DeluxePaint) and then read
the picture with Viewgif and copy the icon into the clipboard. Then you
must call iconedit with custom.ico and then call paste (in all device
formats!) and then call Save As (not save) to your own icon file.
Custom Size:
VIEWGIF starts up in full screen mode or in 640x480 size when the PM
driver screen size is greater. Pressing F5, F6, F7, F8 or F9 sets the
window size to resp. 320x200, 640x400, 640x480, 800x600 and 1024x768. All
the sizes work on any screen driver, but int the menu only the screen
sizes smaller or equal than the device size are shown. The F4 key lets you
set the window to any size (when it fits on the screen). When it doesn't
fit on the screen, you can retry it with switching the title bar and menu
off (F10 or doubleclick on the client window).
With the F12 key the current window size (set with Custom size or just
with the normal resizing of a window), the current client window size is
set to the new bitmap size, so you can cut out parts of a bitmap and then
magnify them with the Scale menu. When you save the file now, the new size
will be the saved to disk too.
Dithering to Monochrome:
T: The picture will be dithered to monochrome with six levels.
H: Halftone dithering. Bright colors will turn white, very dark colors black
and medium colors halftone gray.
R: Random dithering. The chance a certain pixel will be white is proportional
with the intensity of the color.
In all three ways the intensity is counted as follows:
(Red*3 + Green*3 + Blue*2)/8. The picture has two colors, white and black.
Dithering of 256 color pictures to 16 color(4):
With this option a 256 color bitmap can be simulated with using 256 'binary'
colors consisting of two RGB values. The picture will be dithered in halftone.
When you save the bitmap to a file (GIF/PCX/LBM), it will be saved as a 16 color
image.
Saving and loading of files occurs in background, so this slow action won't
block you switching to other tasks. Only the VIEWGIF window is locked during
saving and loading. The same occurs with dithering.
Problems:
---------
The source code for unpacking GIFs is a converted Turbo Pascal program for
unpacking GIFs. I have optimized it somewhat after converting it to C, but it
can be faster. I am working on it. The reading and writing goes through a
separate thread, so VIEWGIF won't block the system while loading a picture and
the user can switch to another program.
Because of the awkward color translation of PM, 256 color pictures do not look
very well on a 16 color PM driver.
Because of the inability to manipulate the palette registers under the
current version of PM ( GpiRealizeColorTable() is a dummy function ) this
program has an IOPL routine to manipulate the DAC registers of the VGA card
directly. Therefore, to run this program you must set in CONFIG.SYS:
iopl=yes
or:
iopl=viewgif
Sometimes the entire screen grab does show an entire white bitmap, but grabbing
once more in the same way does the right thing. I did not yet solve this bug.
On EGA cards the direct palette manipulation does not work, but, still the IOPL
statement must be added to CONFIG.SYS.
Big bitmaps consume much memory, a 1024x768 bitmap consumes 768 K so multiple
VIEWGIF sessions can slow down overall performance due to swapping. On my PC
with 4 Megs RAM (of which 768 K ramdisk and 512 K diskcache, so net 2816 K) two
VIEWGIFs with 640x480 slows down considerably. Because of loading and saving
performance reasons I translate all bitmaps, even with 16 colors, wo 8 bit
bitmaps, but this consumes twice as much memory.
After saving monochrome bitmaps in scaled mode, the screen turns blank. I could
not find the problem, because the bitmap is OK, the saved file and the color
table are all OK. It may be a bug in the way how PM handles bitmaps. When you
reload the newly written file, it's OK.
Trademarks.
----------
DeluxePaint is a registered trademark of Electronic Arts TM.
GIF (Graphic Interchange Format) is a trademark of Compuserve Inc. and the H&R
Block Corporation.
WANTED:
-------
The format of OS/2 1.2 Icons, so I can write .ICO files directly to disk with
Viewgif.
Does someone know if DeluxePaint II exists for OS/2 ? The DOS version is very
good, but I get frustrated with the many 'Not enough memory' messages even with
4 MB RAM on my PC.
Information about direct Color Palette changing in future versions of OS/2.
This is not possible now. The way I use now is hardware dependant. I have a .DLL
with direct color palette change (VGA + Super VGA only) with source code which
you can download from this BBS (PMPAL.ZIP). Viewgif uses the same code, but it's
embedded in it.
Update record:
--------------
VIEWGIF v. 1.2 (20 Jan 90) OS/2 PTK 1.1:
Added ZSOft PCX format.
Fixed bug in Update files, now it saved the entire window, even if it's not
shown entirely.
It has been tested on a Tandon 386/16 and Compaq 386/20e with Video 7 VRAM VGA
board (with all available drivers for it) and a Paradise Plus 16 card with
800x600 PM driver.
VIEWGIF v. 1.3 (14 Feb 90) OS/2 PTK 1.1:
Loading/saving in separate thread.
Also part of picture save added.
Setting of custom window/bitmap size.
VIEWGIF v. 1.4 (11 Mar 90) OS/2 PTK 1.2:
Bug with window maximizing (only in OS/2 1.2) fixed.
Bug with custom size of small pictures (segmentation violation) fixed.
Color icon support enabled for transferring pictures to IconEdit.
VIEWGIF v. 1.5 (23 Mar 90) OS/2 PTK 1.2:
Version 1.4 did not start under OS/2 1.1 because of the color icon. Now VIEWGIF
loads a B/W icon under OS/2 version 1.1.
Also writing to GIF files supported. Picture/window can be set to any size from
32x32 to the screen size.
Monochrome pictures will be written as monochrome pictures to disk when .GIF or
.PCX format is selected.
Icons also to any size from 32x32 to 320x256.
VIEWGIF v. 1.6 (?? Apr 90) OS/2 PTK 1.2:
Confirmation on exiting or loading another file when the bitmap has been altered
by ViewGIF.
Bitmap (16 and 256 color) dithering to monochrome bitmaps.
256 color bitmap dithering to halftone 16 color bitmaps.
VIEWGIF is made by:
Klaas van Ditzhuyzen
DATAD Telecom Products
P.O.Box 371
3900 AJ Veenendaal Holland
Tel +31 8385 33400
Fax +31 8385 26386
For suggestions or bugs, refer to the above address.
You can also leave a message to
Klaas Vanditzhuyzen on the FARGO BBS
(701) 293-5973 2400 n 8 1 MNP 4.
Martin Vermeer on Magnum (Gilmore) BBS
(805) 581-1275 2400 n 8 1 MNP 4.